package model.mediators;

import view.Terminal;
import model.core.Logger;
import java.util.ArrayList;

public class TerminalMediator {
    private Logger log;
    private Terminal terminal;
    private ArrayList<String> buffer = new ArrayList<String>();

    public TerminalMediator(Logger l, Terminal t) {
        this.log = l;
        this.terminal = t;
    }

    public void addToQueue(String s) {
        buffer.add(s);
    }

    public void update() {
        while (!buffer.isEmpty()) {
            terminal.renderText(buffer.remove(0));
        }
    }
}